<template>
    <div class="loan-in-want">
        <transition :name='routerAnim' :mode="routerMode">
            <router-view class='router'></router-view>
        </transition>
    </div>
</template>

<script>
    import { Promise } from 'es6-promise'
    import footerBar from '../components/FooterBar.vue'
    import selectGroup from '../components/SelectGroup.vue'
    import selectOption from '../components/SelectOption.vue'
    import radioGroup from '../components/RadioGroup.vue'
    import areaSelect from '../components/AreaSelect.vue'
    import radio from '../components/Radio.vue'
    import loading from '../components/Loading.vue'
    import checkBox from '../components/CheckBox.vue'
    import toolTip from '../components/ToolTip.vue'
    import modal from '../components/Modal.vue'
    import confirm from '../components/Confirm.vue'
    import buttonLoading from '../components/ButtonLoading.vue'
    import pagination from '../components/Pagination.vue'
    import payPassword from '../components/PayPassword.vue'
    import pickerList from '../components/PickerList.vue'
    import  { mapGetters, mapActions }  from 'vuex'
    import { getOS } from '../utils/utils'
    import { addLenderValidation, resetAccountPasswordValidation, operatorEditValidation } from '../validation/validation'
    import moment from 'moment'

    export default {
        components:{
            footerBar,
            selectGroup,
            selectOption,
            radioGroup,
            radio,
            checkBox,
            areaSelect,
            loading,
            toolTip,
            modal,
            confirm,
            buttonLoading,
            pagination,
            payPassword,
            pickerList
        },
        data() {
            return {
                os:getOS(),
                payways:[{
                    value:0,
                    display:'还款方式1'
                },{
                    value:1,
                    display:'还款方式2'
                },{
                    value:2,
                    display:'还款方式3'
                }],
                argeement:true,
                payway:-1,
                payPasswordShow:false,
                payStatus:'',
                password:'',
                placeholder:'--',
                userCount:'',
                listInfo:{},
                records:[],
                loading:true,
                loading_count:true,
            }
        },
        computed:{
            ...mapGetters([
                'msgTip',
                'localInfo'
            ]),
            currentPage(){
                if(_.isEmpty(this.listInfo)) return 1
                return this.listInfo.pageNum
            },
            hasUserCount(){
                return !_.isEmpty(this.userCount)
            },
            noEditObject(){
                return _.isEmpty(this.editObject)
            },
            noInvoiceInfo(){
                return _.isEmpty(this.invoiceInfo)
            },
            routerAnimation(){
                return this.localInfo.routerAnimation
            },
            routerAnim(){
                if(this.os == 'Android'){
                    return ''
                }
                if(this.os != 'Android'){
                    return this.routerAnimation
                }
            },
            routerMode(){
                if(this.os == 'Android'){
                    return 'out-in'
                }
                if(this.os != 'Android'){
                    return ''
                }
            }
        },
        methods:{
            // actions
            ...mapActions([
                'showLoading',
                'hideLoading',
                'setMsgTip',
                'localInfo'
            ]),

            // filters
            timestampToDate(timestamp){
                if(!timestamp) return this.placeholder
                return moment(timestamp).format('YYYY-MM-DD')
            },

            // function

            test(){
                console.log(1)
            },
            goPay(){
                this.payStatus = true
                console.log(1)
            },
            goDetail(item){
                this.$router.push({
                    name:'user-detail',
                    params:{
                        id:item.userId,
                    }
                })
            },
        },
        created(){
            
        }
    }
</script>

<style lang="scss">
    @import "../sass/variables";
    @import "../sass/extends";
    @import "../sass/mixins";
    .loan-in-want{
        .explain{
            @extend %font-caption;
            padding:8px 24px 0 24px;
            color:$importColor;
        }
        .money-info{
            margin-top:16px;
        }
        .money-info__header{
            display: flex;
        }
        .money-info__title{
            @extend %font-body1;
            color:$importColor;
            padding-bottom: 8px;
            margin-bottom: 8px;
            border-bottom:1px solid $sectionColor;
        }
        .money-info__box{
            width: 100%;
            flex:1;
            &:nth-of-type(2n){
                margin-left:24px;
            }
        }
        .money-info__item{
            @extend %font-caption;
            padding-top: 4px;
            display: flex;
            justify-content:space-between;
        }
        .money-info__number{
            @extend %font-subhead;
            color:$orange;
            padding-top: 4px;
            text-align:right
        }
        .plan{
            padding-top: 16px;
        }
        .agreement{
            padding:16px;
        }
        .agreement__text{
            @extend %font-body1;
            display: block;
            color:$importColor;
        }
        .tips{
            @extend %font-caption;
            color:rgba(#000,.26);
            padding:0 16px 100px 16px;
            line-height: 20px;
        }
        .footer{
            position: absolute;
            bottom:0;
            left:0;
            right:0;
            padding-bottom: 22px;
            padding-top: 14px;
            background-image:linear-gradient(-180deg, rgba(245,245,245,0.00) 0%, #f5f5f5 75%);
        }
    }

</style>
